import { _decorator, Component, director, EditBox, Label, Node, ProgressBar, resources, Sprite, Toggle, tween, Vec2, Vec3 } from 'cc';
import { UIManager } from '../UIManager';
import { LanauageManager } from '../LanauageManager';
import { GameData } from '../GameData';
import { HttpClient } from '../net/HttpClient';
import { EventManager } from '../EventManager';
import { EventManger } from '../../appComon/scripts/EventManger';
const { ccclass, property } = _decorator;

@ccclass('login')
export class login extends Component {

    @property(ProgressBar)  
    progre: ProgressBar = null; 

    public static self:any;

    onEnable() {
        login.self = this;
        this.progre.progress = 0;
        
        tween(this.progre)
        .to(1,{progress:0.90}, { easing: 'quadIn' })
        .start();
        resources.preloadDir("ui", ()=>{
            console.log("preload success")
            //director.loadScene("game")  
         })
        director.preloadScene("login", this.onComplete)
    }


    onComplete() {  
        console.log("preload game success")
        tween(login.self.progre)
        .to(0.2,{progress:0.98})
        .call(()=>{
            console.log("load game success")
            director.loadScene("login") 
        })
        .to(0.1,{progress:1})
        .to(50,{progress:1})
        .start();
    } 
}

